<?php 



        $errorzip               = "";
        $activtedstring         = "";
        $uregisterfirstname     = "";
        $errormail              = "";
        $uregisterlastname      = "";
        $uregistervisningsnavn  = "";
        $uregisteremail         = "";
        $uregisterzip           = "";
        $uregisterpassword      = "";
        $uregisterpassword1     = "";
        $uregisterborn          = "";
        $uregistergender        = "";
        $errorpass              = "";
        $message                = "";
        
 if(isset($_POST['uregistergender'])){
   $uregistergender = trim($_POST['uregistergender']);
    }
    if (isset($_POST['uregister'])){
        
        
       // $session->logout();
      
        $uregisterfirstname     = trim($_POST['uregisterfirstname']);
        $uregisterlastname      = trim($_POST['uregisterlastname']);
        $uregistervisningsnavn  = trim($_POST['uregistervisningsnavn']);
        $uregisteremail         = trim($_POST['uregisteremail']);
        $uregisterzip           = trim($_POST['uregisterzip']);
        $uregisterborn          = trim($_POST['userregisterborn']);
        $uregisterpassword      = trim($_POST['uregisterpassword']);
        $uregisterpassword1     = trim($_POST['uregisterpassword1']);
        require_once($_SERVER['DOCUMENT_ROOT']."/includes/controller/user_controller.php");
        $user_controller = new UserController();
       $message = $user_controller->newUser($uregisterfirstname,$uregistergender,$uregisterlastname,$uregistervisningsnavn,$uregisteremail,$uregisterzip,$uregisterborn,$uregisterpassword,$uregisterpassword1);
    }

echo "<div=id'error'>".$message."</div>";
?>

<form id="uregister" method="post" action="#"  >
        <p>
       <br/>
      <label > Fornavn</label> <em>*</em><input type="text" name="uregisterfirstname" size="25" required="required" minlength="2" value="<?php echo htmlentities($uregisterfirstname);?>"/><br />
       </p>
       
        <p>
       <label> Etternavn </label> <em>*</em><input type="text" name="uregisterlastname" size="25" required="required" minlength="2"   value="<?php echo htmlentities($uregisterlastname);?>"/><br />
       </p>
    <p>   
  <label> Fødselsår </label> <em>*</em>
<select name="userregisterborn" value="uregisteryear" required="required">
    <option><?php echo htmlentities($uregisterborn);?></option>
    
<?php 
       $cur = date("Y", time());
       $cur1 = $cur -10;
for($i=$cur1;$i>1920;$i--){
    echo ('<option value="'.$i.'" >'.$i.'</option>');
}            ?>
    
</select>

    </p>
       
       
       
        <p>
       <br/>
      <label > Visningsnavn</label> <em>*</em><input type="text" name="uregistervisningsnavn" size="25" required="required" minlength="2" value="<?php echo htmlentities($uregistervisningsnavn);?>"/><br />
       </p>
        <p>
     <label> Epost </label> <em>*</em><input type="email" name="uregisteremail" size="25"  required="required" value="<?php echo htmlentities($uregisteremail);?>"><br />
       </p>
        <p>
   
  <label>Kjønn:</label> <em>*</em>
	<input type="radio" required x-moz-errormessage="Velg kjønn" name="uregistergender" id="sex" value="male" <?php if($uregistergender == "male"){echo "checked";} ?> /> Mann
	                <input type="radio" required x-moz-errormessage="Velg kjønn" name="uregistergender" id="sex" value="female" <?php if($uregistergender == "female"){echo "checked";} ?> /> Kvinne	        	        
       </p>
        <p>
      <label> Postnummer </label> <em>*</em><input type="number" name="uregisterzip" size="25" required="required" max="4" value="<?php echo htmlentities($uregisterzip);?>" /><br />
       </p>
        <p>
       <br/>
       <label> Passord </label><em>*</em><input type="password" name="uregisterpassword" required="required" min="6" size="25"  placeholder="Skriv passord" value="<?php echo htmlentities($uregisterpassword);?>" />
       </p>
        <p>
            <label> Gjenta Passord </label><em>*</em><input type="password" name="uregisterpassword1" required="required" size="25" minlength="6"  placeholder="Gjenta passord" value="<?php echo htmlentities($uregisterpassword1);?>"/>
       </p>
        <p>
 <input type="submit" name="uregister" value="Sendinn" /> 
        </p>
 </form>
